<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.io.PrintWriter"%>
<%@ page import="java.util.*"%>
<%@ page import="javax.servlet.*"%>
<%@page import="model.MonHocTuyenQuyetM"%>
<%@page import="dao.MonHocTuyenQuyetD"%>
<%
	MonHocTuyenQuyetD dao = new MonHocTuyenQuyetD();
	int strStatus = 0;
	int check = 0;
	String id_mon_hoc = request.getParameter("id_mon_hoc");
	String id_mon_hoc_tq = request.getParameter("id_mon_hoc_tq");
	try {
		if(id_mon_hoc!="" && id_mon_hoc_tq!=""){
			String[] str = id_mon_hoc_tq.split(",");
			for (int k = 0; k < str.length; k++) {
				if (Integer.parseInt(id_mon_hoc) == Integer.parseInt(str[k])) {
					check = 2;
				}
				if (dao.checkExists(Integer.parseInt(id_mon_hoc),Integer.parseInt(str[k])) >= 1) {
					check = 1;
				}
			}
			if (check == 2) {
				strStatus = 2;
			}
			if (check == 1) {
				strStatus = 1;
			}
		}
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	out.println(strStatus);
%>